<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%@ page language="java" %>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<meta HTTP-EQUIV="EXPIRES" CONTENT="0">
<meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
   
   <script>
      $(document).ready(function() {
         $('.listingTbl tr:even').addClass("evenRow");
         $('.listingTbl tr:odd').addClass("oddRow");
         if (Form.wasteTypeId.value != '')
            top.document.title = 'Saahas WMS | Edit Waste Type Details';
         else
            top.document.title = 'Saahas WMS | Add Waste Type Details';
      })
      
      // Saves the waste type details
      function save()
      {
         fnForward('wasteType.shs', 'saveWasteType');
      }
   </script>
</head>
<body class="textInputNormal_12">

   <form name="wasteTypeForm" method="post">
      <input type="hidden" name="impl"/>
      <input type="hidden" name="wasteTypeId" value="${wasteTypeForm.wasteTypeId}"/>
      <script>
         var pgName = "wasteType";
         var Form = document.wasteTypeForm;
      </script>
      
      <input type="button" class="bttn" value=" Save " onclick="save()"/>
      <input type="button" class="bttn" value=" Cancel " onclick="history.go(-1)"/>
      <br/><br/>
      <c:if test="${wasteType.message != null}">
         <c:choose>
            <c:when test="${wasteType.message == 'success'}">
               <div class="successDiv" style="margin-top: 5px;">
                  Task successfully completed.
               </div>
            </c:when>
            <c:otherwise>
               <div class="errDiv" style="margin-top: 5px;">
                  Task failed!
               </div>
            </c:otherwise>
         </c:choose>
      </c:if>
      
      <div style="margin-top: 10px;">
         <table width="45%" class="listingTbl">
            <tr>
               <td width="40%">
                  <span  class="textSmallCaps">Waste Type Description</span>
               </td>
               <td>
                  <c:set var="tempWasteDesc" />
                  <c:choose>
                     <c:when test="${wasteTypeForm.wasteTypeSrch == null}">
                        <c:set var="tempWasteDesc" value="${wasteType.wasteDesc}"/>
                     </c:when>
                     <c:otherwise>
                        <c:set var="tempWasteDesc" value="${wasteTypeForm.wasteTypeSrch}"/>
                     </c:otherwise>
                  </c:choose>
                  <input type="text" class="textInputNormal_12" size="30"
                     value="${tempWasteDesc}" name="wasteTypeDesc"/>
               </td>
            </tr>
            <tr>
               <td width="40%">
                  <span  class="textSmallCaps">Aggregate Waste Type</span>
               </td>
               <td>
                  <select class="textInputNormal_12" style="width: 58%;" name="aggrWasteTypeId">
                     <c:forEach items="${aggrWasteTypes}" var="aggrWasteType">
                        <option value="${aggrWasteType.aggrWasteId}"
                           <c:if test="${wasteType.aggrWasteId == aggrWasteType.aggrWasteId}">
                              selected
                           </c:if>>
                           ${aggrWasteType.aggrWasteDesc}
                        </option>
                     </c:forEach>
                  </select>
               </td>
            </tr>
            <tr>
               <td width="40%">
                  <span  class="textSmallCaps">Is Saleable</span>
               </td>
               <td>
                  <input type="radio" value="1" name="isSaleable"
                     <c:if test="${wasteType.saleable == 'true'}">
                        checked="true"
                     </c:if>> Yes
                  &nbsp;
                  <input type="radio" value="0" name="isSaleable"
                     <c:if test="${wasteType.saleable == 'false'}">
                        checked="true"
                     </c:if>> No 
               </td>
            </tr>
            <tr>
               <td width="40%">
                  <span  class="textSmallCaps">Average Market Rate</span>
               </td>
               <td>
                  <input type="text" class="textInputNormal_12" size="30" 
                     value="${wasteType.avgMrktRate}" name="avgMrktRate"/>
                  <input type="hidden" name="origMrktRate" 
                     value="${wasteType.avgMrktRate}"/>
               </td>
            </tr>
            <tr>
               <td width="40%">
                  <span  class="textSmallCaps">Common Sources</span>
               </td>
               <td>
                  <input type="text" class="textInputNormal_12" size="30" 
                     value="${wasteType.commSrcs}" name="commSrcs"/>
               </td>
            </tr>
            <tr>
               <td width="40%">
                  <span  class="textSmallCaps">Comments</span>
               </td>
               <td>
                  <textarea name="comments" rows="4" cols="35" class="textInputNormal_12">${wasteType.comments}</textarea>
               </td>
            </tr>
         </table>
      </div>
      
   
   </form>

</body>
</html>